package com.woniuxy.enjoylife.configuration;

import org.springframework.context.annotation.Configuration;

import java.io.FileWriter;
import java.io.IOException;

@Configuration
public class AlipayConfig {
//↓↓↓↓↓↓↓↓↓↓请在这里配置您的基本信息↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓

    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号
    public static String app_id = "2016110400791071";

    // 商户私钥，您的PKCS8格式RSA2私钥
    public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCqyP0L63s872iHCcC5E9ebNDrb7kx2QY/Ss5mwCRdprJXYsWMVwrYM/k5L0YqAxFqIPmlPnrhnXoQ+5dqxBAq5ylD2XNsgW/fvd1wv1dPqKbEziDouD91zgEvkTRDYLli2nqIMG/xQgHJjsqqg8o7usGNF/0BMnf2iqcn5uFyzDjkFzzUCJCTtkMQNPu45NcqZgoKLH5pfTRWwqd7wH/OtnzTHAxf09rc03ZMJGWEq0dUdEHznEXE8q0y8JM0epqrhr3auNcFPMDI/kBAa3rTsWeC8WmYCi7+uXiTpiXT8AgwYF22BvHrUJRqkQCYHZpvN9yi7AizHhfhdUncQM24zAgMBAAECggEALAGkKokf9UCfR4R803PIb6aSsA8ERsh3/cvngxOko8cjyXVT2cyVSl3Q4Pp6XNm7ljW2vxxf2crh+q8RneEzvlHicMjWcc0g4uR3rZ/EficGEQg+LZZK8rMRWx98gqfWlh/kE4i2iCvAze3Ax74YlGqA+g1ejR98tohXkfAuerh3eZzngRZbIeeKSO/m/GKIUVvMkyhaho/J05gYUCibfowM47BndHdju7dIgBlj8YBZU6FeSsdDAhBs3vnVwy42yX5e9NvjqFC1PtFYeZRY49NtsB4acVA15yKLfJWMBb9ukarVZxq/jjGVdCUhB3+1lIrDGHU+kRR5G1dwEg0gUQKBgQDzbsAmm4MmHcJLUnbY2lHunlbZzQyMtkWPHhBkvXUJD4Vl9oSGy/ANUbGqbH/DTfn0ujPYXPyqgIOueUvHS+vALjCmECrO5ActT4ksLqdXIWw1UCwGvGcO5PqIMXsIggUMUuhOwG8H4gbX2Mk8qpMoNReHSaGEFkn03DjVV+4FOQKBgQCzmh2ESDDH3pOx62VCYAjK5d6anUkKnU5n8cmry9digy8tIE4hRO/r1HtLz26MMC+u91rNUQMWmx2Nn/4jLAFdKRX+o20/wn01B/CWDI3rp0xsp1Jl5HXOZz03+0YBN8tsJQg0U//lz5Uh8rQvGjQbn0vI3qCpkRCvS6tiitmaywKBgBI5FjVNqvGthJ/y2ma9YSjFvaasTOYztt1R2NRRwnMdMFVDsQQOPDgjB3PEj4PlUHLbhYoK2/c/i5wCBIQ00L8gNhAYYbv/IfJoY9Jk464IGHudNs6CSAy7Y23Slm06nnofsrhCe41RhEWgOuBJvJ5j6xD7mBW1PXARFEgUPwMxAoGABfUw0XiLlbW+dIJ4g3EoGYLylXJuP9nkBfKxW++RH4V2hSqzLMtaohoUVPl2k1Pt4QH3kyQC1DclDdOm3IfTK8H3JtFJCHptKNswkemss4qDMH+Ebjjb55LpJvhA5D1zlAzObt3yeS8fpValv4JBBEGOhAVOkxFq2kXKU6SDf20CgYEAwSahX0xtGaQf5vnePlyFXRA/9cZ8dGylrkLlxyuzLKttpvx2mBK6oKfV1ycnDkdtyTuXrq2G/S98AXLmpF0AD12YGgv4UrL2eIxn2mzzsHL+DczxFImKgY/0B4aFWVek3oJhMDPmatU2PjAkoRTBGlBpox0Cx+32KWhcqKqdaRM=";

    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。
    public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAqsj9C+t7PO9ohwnAuRPXmzQ62+5MdkGP0rOZsAkXaayV2LFjFcK2DP5OS9GKgMRaiD5pT564Z16EPuXasQQKucpQ9lzbIFv373dcL9XT6imxM4g6Lg/dc4BL5E0Q2C5Ytp6iDBv8UIByY7KqoPKO7rBjRf9ATJ39oqnJ+bhcsw45Bc81AiQk7ZDEDT7uOTXKmYKCix+aX00VsKne8B/zrZ80xwMX9Pa3NN2TCRlhKtHVHRB85xFxPKtMvCTNHqaq4a92rjXBTzAyP5AQGt607FngvFpmAou/rl4k6Yl0/AIMGBdtgbx61CUapEAmB2abzfcouwIsx4X4XVJ3EDNuMwIDAQAB";

    // 服务器异步通知页面路径  需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    // **************************注意：url不能被过滤器拦截**************************
    public static String notify_url = "http://bootystar.free.vipnps.vip/alipay/result";//异步通知的接口，修改订单状态

    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问
    public static String return_url = "http://bootystar.free.vipnps.vip/index.html"; //指定支付成功之后跳转到的页面

    // 签名方式
    public static String sign_type = "RSA2";

    // 字符编码格式
    public static String charset = "utf-8";

    // 支付宝网关
    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";

    // 支付宝网关
    public static String log_path = Thread.currentThread().getContextClassLoader().getResource("").getPath();



//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑

    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     *
     * @param sWord 要写入日志里的文本内容
     */
    public static void logResult(String sWord) {
        FileWriter writer = null;
        try {
            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis() + ".txt");
            writer.write(sWord);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (writer != null) {
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }


}
